<?php
require('config.php');
		/*
		*type:
		*province省
		*city市
		*area区
		*community社区
		*/
		$type='province';
		$areaId='0';
		if(isset($_REQUEST['type'])) $type=$_REQUEST['type'];
		if(isset($_REQUEST['areaId'])) $areaId=$_REQUEST['areaId'];
		if($type=='community')
		{
			$sql="select communityId as areaId,communityName as areaName from `".$oto."_communitys` where `communityFlag`='1' and isShow='1' and areaId3='{$areaId}' order by communitySort ASC";
		}
		else $sql="select areaId,areaName from `".$oto."_areas` where `areaFlag`='1' and isShow='1' and parentId='{$areaId}' order by areaSort ASC";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$areas[]=$row;//将取得的所有数据赋值给person_info数组
		}
		if(isset($areas)) echo json_encode($areas);
		else echo '[]';
?>